package com.java.shop.order.config;

import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlipayConfig {
    @Bean
    public void setFactory(){
        Config config = new Config();
        config.protocol = "https";
        config.gatewayHost = "openapi.alipaydev.com";
        config.signType = "RSA2";

        config.appId = "2021000117663990";

        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCClWe2joR1UyqxqXHqeL/hUjehlgw6SwYiEBiHSZrQnFKXz9i33zOClXxT9qqUWYKqQ0DLA8GUOMI+B9VNpu/eYKQlAmDbnzqelcrnKOCoIyEVbI8h1/chHKeLwvZjequTMHrID+LL2KuMyScg1qLiJBtDrzp/t4Xb9l5bllI0xZyX14Tez7/4ZdWPI1yNKgbjvJ1iFvDaCBQEPly05XDT4/Q5hIXncuJKbOQIv6z7gtGgI5qQA9TUn7hE1EA6df92YMd2Z8U9ahPfVO8mEIgG1PIp5jyDo7B46VIhyfrh0xaruGIzgg7F+rYNmA0zsED7nTDX3EEz5UpGbL5FJmnTAgMBAAECggEAGeUOwADa+3kWikyTrm9rfX8UURK0MgsWmEKg2pMaBCw7pKcuzqeQS2DhWrUbdneZlbHoc1m3VXE785kSD2f/QRXg9wXVtzeIJFKH/fb5Nd5hfSId8BQniYVpJCnxOiDlTTbb4jhkPRAmVLC+9aAahMWsMmvZKeJ2xPvCEl9oxdXvW/YU00eMVa92dhjNOw2lqxWwQONyeHrIujR23X2oeBEsFuqbYJksJY6vJFkBBr5OZ8tILJpYqELcL3+ZWU+Xd/ujoDwc6DAoSR3FzsypSq+/vP4AUOAffk9XPpZxw7B6wmfavfY85OE04Djtby2vXT6xKkqY5iq0O1N034d5IQKBgQDpZRLA2rlWV4XxftBANBsYed1+3aNYc0kebzrmBHzIVjg9hSIjbr3L7w9uU0dvx/lMHd7Wpb089AP4uemE/L5fLK31y2+1s11gZ99WCQvF92Ui92tZfhzdlvYvtgp7icD08LxnEC53Qzx4P99c0NZ04ppZbskXtojchakR1QcAfQKBgQCPOyvP4xDTbHsccv0U3YhCUG8WgiwkazZi7Y3Ny9GSjWWpx986JRi/FCinhoGCdzvjJyZuMKrfXthU43wq356N7/hmv2GzRCOKtJAD3gOTCI+sRu6b0H1wqHQWuLIspcu4kCXgZCd9coyRI5IgWX3fvQTDiP2q2oC0jF9xwb70jwKBgQCU00yYCWDxe7H/gjvNFOzKOLtSsIX+WtUfQRIvpmDjZodKQ2C3c2A3cGNImHYPA1cmgE2eVeVLvtXhfrs3f+rsyZLMD0NWe99pIBM7y1zkiZLGLzsWv+IsMp0dY1lf2UFfbzrUBW97wTYH/8KwbsKxmeWObaRxKIYxCFH8+vgSCQKBgQCAR7aNkghX0yjP6gzQyzhmbDOSLTPryjoDkE8Yqhsg7pLG5MQBB4iKWjuvDsCfYLq6Ty4UMnJXbFLEdJmYrH8NEIehPnb6X2SVrfHuBMGexmQnH8BEvQ4cAEM4tmKdqkAzJKdHuWvE5vsOYpVVc9FQubGyjtbiVqA/FBnHgIbN8QKBgQCU1zmB5nEXI7WTmstp/bv+mAd1mG6JRn94lIKSVXjAudgAD/tcCGOPzspPJfOyXfktNHeIcsYzjheaeZ1awRIAFILgK0LiryEmI7pcEBYhNdlpl0Kp58yJQiQhPwvv0oKcOU2EYhhQpMlA61cjp52UON06jkfhG4OWvKRZWDBDZA==";

        //注：证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径，优先从文件系统中加载，加载失败后会继续尝试从CLASS_PATH中加载
//        config.merchantCertPath = "<-- 请填写您的应用公钥证书文件路径，例如：/foo/appCertPublicKey_2019051064521003.crt -->";
//        config.alipayCertPath = "<-- 请填写您的支付宝公钥证书文件路径，例如：/foo/alipayCertPublicKey_RSA2.crt -->";
//        config.alipayRootCertPath = "<-- 请填写您的支付宝根证书文件路径，例如：/foo/alipayRootCert.crt -->";

        //注：如果采用非证书模式，则无需赋值上面的三个证书路径，改为赋值如下的支付宝公钥字符串即可
        config.alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzuikquE1pHcda7k09NyJ+Nja3enkboNyaesL6VNEIgzo7ZND2lfTfCr3l0SQNBsP/SG8yvdbs8PrzgZh3A+Q8ptdO+u5HyM2XTXBvx1lQR/NjuiJf7c/4iXwCdlfd0PAbriMh1KGRY+EtJ9W5fJ76wZpnW6zY+XNetB1CdBT7BdohxLZjN+I2iZCPZxoQUURtt1/vZ2uWuXOlR+wTpMMygBSAAGfg4j4ueXTOH1qLJY83ez4x4yHgpk012EOqtV3L5jFsdEzUg4XfE8so/1FbgJDBgOAj1shqpzY7lap69XE2wTcmBufHCcaixydhsNtMBQ7N/J5B+6iHKy3GsAjsQIDAQAB";

        //可设置异步通知接收服务地址（可选）
        config.notifyUrl = "http://shop.cn1.utools.club/payed/notify";

        //可设置AES密钥，调用AES加解密相关接口时需要（可选）
//        config.encryptKey = "<-- 请填写您的AES密钥，例如：aa4BtZ4tspm2wnXLb1ThQA== -->";
        Factory.setOptions(config);
    }
}
